import { Store } from "element-plus/es/components/table/src/store"
import { InjectionKey } from "vue"

export interface ITabe {
    title: string,
    path: string
}

export interface State {
    count: number,
    collapse: boolean,
    tabsList: Array<ITabe>
}

export const key: InjectionKey<Store<State>> = Symbol()

export const MemberInfo = {
    state: {
        drawer: false,
        editFrom: {},
        tabsList: [],
        showExpand:false
    },
    getters: {
        // 获取Tabs
        getTabs(state: State) {
            return state.tabsList
        }
    },
    mutations: {
        // 修改state状态
        setDrawer(state: any) {
            state.drawer = !state.drawer
        },
        editInfo(state: any, info: any) {
            state.editFrom = JSON.parse(JSON.stringify(info))
        },
        // 面包屑tags
        addTab(state: State, tab: ITabe) {
            // 判断是否已经存在,如果不存在,才放入
            if (state.tabsList.some(item => item.path === tab.path)) return;
            state.tabsList.push(tab)
        },

        setExpand(state:any){
            state.showExpand=!state.showExpand
        }
    },
    actions: {
    },
    modules: {
    }
}
// export default MemberInfo


